<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App"/>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import {mapState,mapGetters} from 'vuex'

export default {
  name: 'App',
  components: {
    HelloWorld
  },
  created:function(){
    console.log(this.$store.state.count)
    this.$store.commit('increamentBy',50)
    console.log(this.$store.state.count)
    
    console.log(this.$store.state.userInfo.username)
    this.$store.commit('updateUsername','新的名字')
    console.log(this.$store.state.username)

    this.$store.actions.dispatch('getUserInfo','action的结果')

    //console.log(this.$store.dispatch('getUserInfo','action的结果'))
  },
  computed:{
   ...mapState(['count']),
    ...mapGetters(['todoDone','todoDoneCount'])
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
